<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

    </style>
</head>

<body>
    <h2>无序列表自生成</h2>
    <ul id="ul"></ul>
    <script>
        var datas = ["张三", "李四", "王五", "赵六", "田七"]

        var ul = document.getElementById("ul")

        for (var i = 0; i < datas.length; i++) {
            var li = document.createElement("li")
            li.innerText = datas[i]
            ul.appendChild(li)
        }
    </script>

</body>

</html>